﻿    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="/Scripts/szjt-common.js" type="text/javascript"></script>
        <script src="/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script src="../Scripts/prj-constants.js" type="text/javascript"></script>
        <script src="../Scripts/szjt-constants.js" type="text/javascript"></script>
        <script src="../Scripts/szjt-constants.organization.js" type="text/javascript"></script>
        <style>
        *{ margin:0; padding:0; font-size:10pt; font-family:Verdana;}
        body{overflow:hidden;background:#0a76b0;}
        ul{display:block; margin:0; padding:0; list-style:none;}
        li{display:block; margin:0; padding:0; list-style:none;}
        img{border-style: none;
                border-color: inherit;
                border-width: 0;
                top: 125px;
                left: 65px;
            }
        #backgroundPic{background-image: url('/Images/Login.png');width:1280px;height:1024px;position:absolute;top:50%;margin-top:-512px;left:50%;margin-left:-640px;}
        #loginPanel{width:600px;height:300px;position:absolute;top:50%;margin-top:-170px;left:50%;margin-left:-300px}
        #logo{display:block;width:500px;height:60px;margin:0 auto;background:url(/images/logo.png) no-repeat}
        #loginContent{width: 300px;margin: 70px 10px 0 auto}
        #loginContent ul li{margin-bottom:20px;margin-bottom:20px; overflow:hidden;}
        #loginContent ul li label{font-size:20px;width:60px;margin-top:3px;line-height:30px; color:#dbf2ff; float:left}
        .loginInput{width:150px;color:#064880;border: 1px inset #dbf2ff;line-height: 25px; height: 25px; padding: 0 5px;display:block;background-color: transparent;}
        .loginbtn{width:120px; height:40px;background:url(/images/loginbtn.png) no-repeat center; border:0; text-align:center;color:#fff; cursor:pointer;}
        #copyright{text-align:center;color: #337DD6;margin:30px auto auto -20px}
        </style>
    </head>
    <body>
        <noscript>
            <div style="position: absolute; z-index: 100000; height: 2046px; top: 0px; left: 0px;
                width: 100%; background: white; text-align: center;">
                <img src="/images/noscript.gif" alt='抱歉，请开启脚本支持！' />
            </div>
        </noscript>
        <div id="backgroundPic" />
        <div id="loginPanel">
            <div id="logo"></div>
            <img alt="" src="/Images/Keys.png" style="position: absolute; width: 128px; height: 128px" />
            <div id="loginContent">
                <ul>
                    <li><label>帐号</label><input type="text" id="login_UserName" class="loginInput" value="llq"/></li>
                    <li><label>密码</label><input type="password" id="login_Password" class="loginInput" value="linqi" /></li>
                    <li><label>验证码</label><input type="text" id="login_VerifyCode" class="loginInput" value="abcd" /></li>
                    <li><input id="btnLogin" type="submit" value="登 录" class="loginbtn" />
                        <input name="" type="button" value="退 出" class="loginbtn" onclick="window.close();" /></li>
                </ul>
            </div>
            <div id="copyright" style=""></div>
        </div>
            <script type="text/javascript">
                function CookieEnable() {
                    var result = false;
                    if (navigator.cookiesEnabled)
                        return true;
                    document.cookie = "testcookie=yes;";
                    var cookieSet = document.cookie;
                    if (cookieSet.indexOf("testcookie=yes") > -1)
                        result = true;
                    document.cookie = "";
                    return result;
                }


                function sysLogin(userId, password, verifyCode) {

//                    var loginTemplate = utility.xml.convertXmlStringToDoc(SysConstant.Organization.Login.Template);
                    var loginString = utility.xml.fillXmlStringWithHtmlContainer("#loginContent", SysConstant.OrgInfo.Login.Template);
//                    loginTemplate.find("UserName").text(userId);
//                    loginTemplate.find("Password").text(password);
//                    loginTemplate.find("VerifyCode").text(verifyCode);
//                    //var loginTemplate = Constant.SysTemplate.OrgInfo.Login = "<Document TaskGuid='0690f841-7773-445c-9f48-a7a0427686d5' DataGuid ='' DataType = 'PageTicket'><UserNameTicket><UserName>abc</UserName><Password>123</Password><VerifyCode/></UserNameTicket></Document>";
                    //Session._userInfo.UserGuid = "@";
                    var resultStr = dataService.transformData(SysConstant.TaskGuid.OrgInfo, loginString);
                    var result = utility.xml.convertXmlStringToDoc(resultStr);
                    var userGuid = result.find("UserID").text();
                    return userGuid;
                }

                $(document).ready(function () {
                    if (CookieEnable()) {
                        $("#copyright").text(PrjConstant.SysInfo.Copyright);
                        $("#btnLogin").bind("click", function () {
                            var userID = $("#loginUserName").val();
                            var userGuid = sysLogin(userID, $("#loginPassword").val(), $("#loginVerify").val());
                            if (userGuid != "") {
                                Session._userInfo.UserGuid = userGuid;
                                var memberInfo = dataService.getData(SysConstant.TaskGuid.OrgInfo, userGuid, SysConstant.OrgInfo.Member.MemberInfo.DataType);
                                var memberXml = utility.xml.convertXmlStringToDoc(memberInfo);
                                Session._userInfo.UserName = memberXml.find("Name").text();
                                document.cookie = "UserID=" + escape(userID);
                                document.cookie = "UserGuid=" + escape(userGuid);
                                document.cookie = "UserName=" + escape(memberXml.find("Name").text());
                                document.cookie = "DeptGuid=" + escape(memberXml.find("BranchGuid").text());
                                document.cookie = "DeptName=" + escape(memberXml.find("BranchName").text());
                                window.location.href = '/Pages/index.htm';
                            }
                            else {
                                $.messager.alert("登录失败", "您输入的帐号或密码不正确，请重新输入！", "error", function () {
                                    $("#loginUserName").select();
                                    $("#loginUserName").focus();
                                });
                            }
                        });
                        $("#loginUserName").focus();
                    } else {
                        $.messager.alert("环境不符要求", "本应用系统需要Cookie支持，但您的浏览器不支持Cookie或已关闭Cookie，请更换支持Cookie的浏览器或启用Cookie选项。");
                    }
                });
            </script>
    </body>
    </html>
